import request from '@/utils/request'
// import {formDataFun} from './public'
function formDataFun(data) {
  const param = new FormData()
  const keys = Object.keys(data)
  keys.forEach((item, index) => {
    param.append(item, data[item])
  })
  return param
}

export function dataModeltypegetList(data) {
  return request({
    url: '/ht-datacenter/dataModel/type/getList',
    method: 'post',
    data: data
  })
}

export function dataModeltypesaveOne(data) {
  return request({
    url: '/ht-datacenter/dataModel/type/saveOne',
    method: 'post',
    data: data
  })
}

export function dataModeltypeupdateById(data) {
  return request({
    url: '/ht-datacenter/dataModel/type/updateById',
    method: 'post',
    data: data
  })
}

export function dataModeltypedeleteByIds(data) {
  return request({
    url: '/ht-datacenter/dataModel/type/deleteByIds',
    method: 'post',
    data: data
  })
}

// ----------
export function dataModelapplygetList(data) {
  return request({
    url: '/ht-datacenter/dataModel/apply/getList',
    method: 'post',
    data: data
  })
}
// -------------
export function codequery(data) { // 项目所有下拉框
  return request({
    url: '/ht-datacenter/code/query',
    method: 'post',
    data: data
  })
}
// -------------
export function dataModeldatagetList(data) {
  return request({
    url: '/ht-datacenter/dataModel/data/getList',
    method: 'post',
    data: data
  })
}

export function dataModeldatadeleteByIds(data) {
  return request({
    url: '/ht-datacenter/dataModel/data/deleteByIds',
    method: 'post',
    data: data
  })
}

export function dataModeldataupdateById(data) {
  return request({
    url: '/ht-datacenter/dataModel/data/updateById',
    method: 'post',
    data: data
  })
}
export function dataModeldatasaveOne(data) {
  return request({
    url: '/ht-datacenter/dataModel/data/saveOne',
    method: 'post',
    data: data
  })
}
// -----------------------
export function clusterpage(data) {
  return request({
    url: '/ht-datacenter/cluster/page',
    method: 'post',
    data: data
  })
}
export function clustersavaClusterInfo(data) {
  return request({
    url: '/ht-datacenter/cluster/savaClusterInfo',
    method: 'post',
    data: data
  })
}
export function clusterupdateClusterInfo(data) {
  return request({
    url: '/ht-datacenter/cluster/updateClusterInfo',
    method: 'post',
    data: data
  })
}
export function clusterdelete(v) {
  return request({
    url: '/ht-datacenter/cluster/deleteById',
    method: 'post',
    data: v
  })
}
// -----------------------
export function topiccreateTopic(data) {
  return request({
    url: '/ht-datacenter/topic/createTopic',
    method: 'post',
    data: data
  })
}
export function topicdeleteTopic(data) {
  return request({
    url: '/ht-datacenter/topic/deleteTopic',
    method: 'post',
    data: data
  })
}

export function topicqueryTopicData(data) {
  return request({
    url: '/ht-datacenter/topic/queryTopicData',
    method: 'post',
    data: data
  })
}
export function clusterlist(data) {
  return request({
    url: '/ht-datacenter/cluster/list',
    method: 'post',
    data: data
  })
}
export function topiclist(data) {
  return request({
    url: '/ht-datacenter/topic/list?cluster=' + data.cluster,
    method: 'get'
  })
}
export function topicsendDataToTopic(v) {
  return request({
    url: '/ht-datacenter/topic/sendDataToTopic',
    method: 'post',
    data: v
  })
}
// -----------------------
export function topicTaskget(data) { // 获取单个信息
  return request({
    url: '/ht-datacenter/topicTask/get',
    method: 'post',
    data: data
  })
}
export function topicTaskdelete(data) {
  return request({
    url: '/ht-datacenter/topicTask/deleteTopicTask',
    method: 'post',
    data: data
  })
}
export function topicTasksave(v) { // 保存
  return request({
    url: '/ht-datacenter/topicTask/save',
    method: 'post',
    data: v
  })
}
export function topicTasksavaTopicTask(v) { // 保存
  return request({
    url: '/ht-datacenter/topicTask/savaTopicTask',
    method: 'post',
    data: v
  })
}
export function topicTaskupdateTopicTask(v) { // 改
  return request({
    url: '/ht-datacenter/topicTask/updateTopicTask',
    method: 'post',
    data: v
  })
}
export function topicTaskpage(data) { // 分页数据
  return request({
    url: '/ht-datacenter/topicTask/page',
    method: 'post',
    data: data
  })
}
// -----------------------
export function dataQualityrulegetList(data) { //
  return request({
    url: '/ht-datacenter/dataQuality/rule/getList',
    method: 'post',
    data: data
  })
}
export function dataQualityrulesaveOne(data) {
  return request({
    url: '/ht-datacenter/dataQuality/rule/saveOne',
    method: 'post',
    data: data
  })
}
export function dataQualityruleupdateById(v) { //
  return request({
    url: '/ht-datacenter/dataQuality/rule/updateById',
    method: 'post',
    data: v
  })
}
export function dataQualityruledeleteByIds(data) { //
  return request({
    url: '/ht-datacenter/dataQuality/rule/deleteByIds',
    method: 'post',
    data: data
  })
}
// ----
export function dataQualityloggetList(data) { // log
  return request({
    url: '/ht-datacenter/dataQuality/log/getList',
    method: 'post',
    data: data
  })
}
export function dataQualitylogdeleteByIds(data) { // log
  return request({
    url: '/ht-datacenter/dataQuality/log/deleteByIds',
    method: 'post',
    data: data
  })
}
export function dataQualityloggetLogDetailList(data) { // log
  return request({
    url: '/ht-datacenter/dataQuality/log/getLogDetailList',
    method: 'post',
    data: data
  })
}

// ---------------------
export function dataSubjectdirectorygetList(data) {
  return request({
    url: '/ht-datacenter/dataSubject/directory/getList',
    method: 'post',
    data: data
  })
}

export function dataSubjectdirectorysaveOne(data) {
  return request({
    url: '/ht-datacenter/dataSubject/directory/saveOne',
    method: 'post',
    data: data
  })
}
export function dataSubjectdirectoryupdateById(data) {
  return request({
    url: '/ht-datacenter/dataSubject/directory/updateById',
    method: 'post',
    data: data
  })
}
export function dataSubjectdirectorydeleteByIds(data) {
  return request({
    url: '/ht-datacenter/dataSubject/directory/deleteByIds',
    method: 'post',
    data: data
  })
}
// -------------------
export function dataSubjectdataSetgetSubjectNode(v) {
  return request({
    url: '/ht-datacenter/dataSubject/dataSet/getSubjectNode',
    method: 'post',
    data: v
  })
}
export function dataSubjectdataSetgetDataAccessTask(data) {
  return request({
    url: '/ht-datacenter/dataSubject/dataSet/getDataAccessTask',
    method: 'post',
    data: data
  })
} //

export function dataSubjectdataSetaddDataSet(data) {
  return request({
    url: '/ht-datacenter/dataSubject/dataSet/addDataSet',
    method: 'post',
    data: data
  })
}
export function dataSubjectdataSetgetDataSetInfo(data) {
  return request({
    url: '/ht-datacenter/dataSubject/dataSet/getDataSetInfo',
    method: 'post',
    data: data
  })
}
export function dataSubjectdataSetdeleteDataSet(data) {
  return request({
    url: '/ht-datacenter/dataSubject/dataSet/deleteDataSet',
    method: 'post',
    data: data
  })
}
// -------------------------
export function desensitizationrulegetList(data) {
  return request({
    url: '/ht-datacenter/desensitization/rule/getList',
    method: 'post',
    data: data
  })
}
export function desensitizationruledeleteByIds(data) {
  return request({
    url: '/ht-datacenter/desensitization/rule/deleteByIds',
    method: 'post',
    data: data
  })
}
export function desensitizationrulesaveOne(data) {
  return request({
    url: '/ht-datacenter/desensitization/rule/saveOne',
    method: 'post',
    data: data
  })
}
export function desensitizationruleupdateById(data) {
  return request({
    url: '/ht-datacenter/desensitization/rule/updateById',
    method: 'post',
    data: data
  })
}
// --------------------
export function desensitizationapplygetList(data) {
  return request({
    url: '/ht-datacenter/desensitization/apply/getList',
    method: 'post',
    data: data
  })
}
export function desensitizationapplybindApply(data) {
  return request({
    url: '/ht-datacenter/desensitization/apply/bindApply',
    method: 'post',
    data: data
  })
}

// -------------------------------------

export function dataServepage(data) {
  return request({
    url: '/ht-datacenter/dataServe/page',
    method: 'post',
    data: data
  })
}
export function dataServesave(data) {
  return request({
    url: '/ht-datacenter/dataServe/save',
    method: 'post',
    data: data
  })
}
export function dataServedelete(data) {
  return request({
    url: '/ht-datacenter/dataServe/delete',
    method: 'post',
    data: data
  })
}

// 调度管理-----------------------------
export function dispatchsave(data) {
  return request({
    url: '/ht-datacenter/dispatch/save',
    method: 'post',
    data: data
  })
}
export function dispatchdelete(data) {
  return request({
    url: '/ht-datacenter/dispatch/delete',
    method: 'post',
    data: data
  })
}
export function dispatchpage(data) {
  return request({
    url: '/ht-datacenter/dispatch/page',
    method: 'post',
    data: data
  })
}

// API
export function apiInfosave(data) {
  return request({
    url: '/ht-datacenter/apiInfo/save',
    method: 'post',
    data: data
  })
}
export function apiInfodelete(data) {
  return request({
    url: '/ht-datacenter/apiInfo/delete',
    method: 'post',
    data: data
  })
}
export function apiInfopage(data) {
  return request({
    url: '/ht-datacenter/apiInfo/page',
    method: 'post',
    data: data
  })
}

// HTTP

export function httpRequestupdate(data) {
  return request({
    url: '/ht-datacenter/httpRequest/update',
    method: 'post',
    data: data
  })
}
export function httpRequestsave(data) {
  return request({
    url: '/ht-datacenter/httpRequest/save',
    method: 'post',
    data: data
  })
}
export function httpRequestdelete(data) {
  return request({
    url: '/ht-datacenter/httpRequest/delete',
    method: 'post',
    data: data
  })
}
export function httpRequestpage(data) {
  return request({
    url: '/ht-datacenter/httpRequest/page',
    method: 'post',
    data: data
  })
}
export function httpRequeststart(data) {
  return request({
    url: '/ht-datacenter/httpRequest/start',
    method: 'post',
    data: data
  })
}
export function httpRequeststop(data) {
  return request({
    url: '/ht-datacenter/httpRequest/stop',
    method: 'post',
    data: data
  })
}
export function httpRequesttrigger(data) {
  return request({
    url: '/ht-datacenter/httpRequest/trigger',
    method: 'post',
    data: data
  })
}
export function apiInfosend(data) {
  return request({
    url: '/ht-datacenter/apiInfo/send',
    method: 'post',
    data: data
  })
}
// 数据源

export function dataSourcepage(data) {
  return request({
    url: '/ht-datacenter/dataSource/page',
    method: 'post',
    data: data
  })
}
export function dataSourcedelete(data) {
  return request({
    url: '/ht-datacenter/dataSource/delete',
    method: 'post',
    data: data
  })
}
export function dataSourcesave(data) {
  return request({
    url: '/ht-datacenter/dataSource/save',
    method: 'post',
    data: data
  })
}
export function dataSourcesaveDataSource(data) {
  return request({
    url: '/ht-datacenter/dataSource/saveDataSource',
    method: 'post',
    data: data
  })
}
export function dataSourcelist(data) {
  return request({
    url: '/ht-datacenter/dataSource/list',
    method: 'post',
    data: data
  })
}
export function dataSourcequeryAllTableName(data) {
  return request({
    url: '/ht-datacenter/dataSource/queryAllTableName',
    method: 'post',
    data: data
  })
}
export function dataSourceget(data) {
  return request({
    url: '/ht-datacenter/dataSource/getDataById',
    method: 'post',
    data: data
  })
}
export function dataSourcemoveTableData(data) {
  return request({
    url: '/ht-datacenter/dataSource/moveTableData',
    method: 'post',
    data: data
  })
}
//
export function dataSourcegetAllColumns(data) {
  return request({
    url: '/ht-datacenter/dataSource/getAllColumns',
    method: 'post',
    data: data
  })
}
// 服务对象管理
export function serverObjectpage(data) {
  return request({
    url: '/ht-datacenter/serverObject/page',
    method: 'post',
    data: data
  })
}
export function serverObjectdelete(data) {
  return request({
    url: '/ht-datacenter/serverObject/delete',
    method: 'post',
    data: data
  })
}
export function serverObjectsave(data) {
  return request({
    url: '/ht-datacenter/serverObject/save',
    method: 'post',
    data: data
  })
}
// ---
export function databaselist(data) {
  return request({
    url: '/ht-datacenter/database/list',
    method: 'post',
    data: data
  })
}
export function dataSourceconnect(data) {
  return request({
    url: '/ht-datacenter/dataSource/connect',
    method: 'post',
    data: data
  })
}
export function dataServequeryHomeCount(data) {
  return request({
    url: '/ht-datacenter/dataServe/queryHomeCount',
    method: 'post',
    data: data
  })
}
export function dataSubjectdataSetgetDataSetBarGraph(data) {
  return request({
    url: '/ht-datacenter/dataSubject/dataSet/getDataSetBarGraph?index=' + data.index,
    method: 'post'
  })
}

export function dataServequeryPieCount(data) {
  return request({
    url: '/ht-datacenter/dataServe/queryPieCount',
    method: 'post'
  })
}

export function desensitizationrulegetRuleListByDataModelId(data) {
  return request({
    url: '/ht-datacenter/desensitization/rule/getRuleListByDataModelId',
    method: 'post',
    data: data
  })
}
export function indexgetUseageInfo(data) {
  return request({
    url: '/ht-datacenter/index/getUseageInfo',
    method: 'post',
    data: data
  })
}

export function indexgetDataSourceRate(data) {
  return request({
    url: '/ht-datacenter/index/getDataSourceRate?type=' + data.type,
    method: 'post'
  })
}
export function indexgetServiceInfo(data) {
  return request({
    url: '/ht-datacenter/index/getServiceInfo',
    method: 'post',
    data: data
  })
}
export function requestLoggetRequestStatusCount(data) {
  return request({
    url: '/ht-datacenter/requestLog/getRequestStatusCount',
    method: 'get'
  })
}
export function allApipage(data) {
  return request({
    url: '/ht-datacenter/allApi/page',
    method: 'post',
    data: data
  })
}
export function tbQualityRunLogDataList(data, page, size) {
  return request({
    url: `/ht-datacenter/tbQualityRunLog/dataList?requestId=${data}&pageSize=${size}&pageNum=${page}`,
    method: 'get'
  })
}
export function MQMonitorkafka(data) {
  return request({
    url: '/ht-datacenter/MQMonitor/kafka?clusterID=' + data.clusterID,
    method: 'get'
  })
}
export function dicqueryList(data) {
  return request({
    url: '/ht-datacenter/dic/queryList',
    method: 'get'
  })
}

export function MQMonitorkafkagetLagRecordKafka(group, partition, topic) {
  return request({
    url: `/ht-datacenter/MQMonitor/kafka/getLagRecordKafka?group=${group}&partition=${partition}&topic=${topic}`,
    method: 'get'
  })
}
